package com.dianxin.farm.config;

import com.github.wxpay.sdk.WXPayConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

/**
 * @auther xukai
 * @date 2020/9/27.
 */
@Service
public class MyWxPayConfig implements WXPayConfig {

    @Value("${appId}")
    private String appId;

    @Value("${merchantId}")
    private String merchantId;


    @Value("${key}")
    private String key;

    private byte[] certData;

    @Override
    public String getAppID() {
        return appId;
    }

    @Override
    public String getMchID() {
        return merchantId;
    }

    @Override
    public String getKey() {
        return key;
    }

    @Override
    public InputStream getCertStream() {
        return new ByteArrayInputStream(this.certData);
    }

    @Override
    public int getHttpConnectTimeoutMs() {
        return 0;
    }

    @Override
    public int getHttpReadTimeoutMs() {
        return 0;
    }
}
